import os
import sys
import django

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zyy_django.settings")
django.setup()

from apps.publish import models


# 插入发布数据脚本  模拟数据发布
#
# publish_obj = models.PublishModel.objects.create(
#         cover="https://zzy-1307622602.cos.ap-nanjing.myqcloud.com/0c2kh1ck1700053628482.jpg",
#         text=f"新数据2",
#         topic_id=1,
#         user_id=1
#     )
#
# models.PublishImageModel.objects.create(
#     key="0c2kh1ck1700053628482.jpg",
#     cos_path="https://zzy-1307622602.cos.ap-nanjing.myqcloud.com/0c2kh1ck1700053628482.jpg",
#     article = publish_obj
# )


for i in range(1,36):
    publish_obj = models.PublishModel.objects.create(
        cover="https://zzy-1307622602.cos.ap-nanjing.myqcloud.com/elt7pgib1700049302671.png",
        text=f"还有{i}天结束",
        topic_id=1,
        user_id=1
    )

    models.PublishImageModel.objects.create(
        key="elt7pgib1700049302671.png",
        cos_path="https://zzy-1307622602.cos.ap-nanjing.myqcloud.com/elt7pgib1700049302671.png",
        article = publish_obj

    )

    models.PublishImageModel.objects.create(
        key="0c2kh1ck1700053628482.jpg",
        cos_path="https://zzy-1307622602.cos.ap-nanjing.myqcloud.com/0c2kh1ck1700053628482.jpg",
        article = publish_obj

    )